package com.example.jzg.mvpdemo.presenter;

import com.example.jzg.mvpdemo.baserx.RxSubscriber;
import com.example.jzg.mvpdemo.bean.LoginBean;
import com.example.jzg.mvpdemo.contract.LoginContract;

/**
 * author: guochen
 * date: 2016/12/2 17:43
 * email: 
 */
public class LoginPresenter extends LoginContract.Presenter {

    @Override
    public void login() {
        mRxManage.add(mModel.login(mView.getParams())
                .subscribe(new RxSubscriber<LoginBean>(mContext,true) {
            @Override
            protected void _onNext(LoginBean loginBean) {
                mView.loginSuccess(loginBean);
            }

            @Override
            protected void _onError(String message) {
                mView.showError(message);
            }
        }));
    }
}
